<?php
    class RegistSuccessController extends \Yaf\Controller_Abstract{
        public function init(){
            Yaf\Dispatcher::getInstance()->disableView();
        }
        public function successRegisAction(){

            $token = $_GET['verify'];
//            echo $token;
//            首先通过条件查找到ID
            $Id = UsersModel::where('token','=',$token)->select('id')->get();
            if (count($Id)>0) {
                $result = json_decode($Id, true);
                $id = $result[0]['id'];
//                echo $id;
//            然后通过id查找到数据进行修改status
                UsersModel::where('id', $id)->update(['status' => 1]);
                header("refresh:0.5;url=/index.php?c=Login&a=LoginFucntion");
                echo "<script>alert('激活成功')</script>";
            }else{
                header("refresh:3;url=/index.php?c=Register&a=RegisterFunction");
                print('激活失败<br>请重新注册。');
                echo "<script>alert('激活失败，请重新注册在注册页面注册......')</script>";
            }
        }
    }